﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace AesEncrypt
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            using (Aes myAes = Aes.Create())
            {
                AesEncryptExtension aes = new AesEncryptExtension();
                textBox2.Text = aes.Encrypt(textBox1.Text, myAes.Key, myAes.IV);
                textBox3.Text = Convert.ToBase64String(myAes.IV);
                textBox4.Text = Convert.ToBase64String(myAes.Key);
            }
            Form3 form = new Form3();
            form.Show();
        }
    }
}